#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
	int x=0;bool f=0;char ch=getchar();
	while(ch<'0'||ch>'9')f^=(ch=='-'),ch=getchar();
	while('0'<=ch&&ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int Maxn=5e5+5;
int n,q;
int a[Maxn];
namespace sub1{
	inline void solve(){
		
	}
}
namespace sub2{
	int p=0,q=1;
	inline void solve(){
		for(int i=1;i<=n;i++)a[i]+=a[i-1];
		int L=read(),R=read();
		for(int len=1;len<=5000;len++){
			for(int l=L;l+len-1<=R;l++){
				int tt=(a[l+len-1]-a[l-1])*(a[l+len-1]-a[l-1]);
				if(tt*q>p*len){
					p=tt;q=len;
					int tmp=__gcd(p,q);
					p/=tmp;q/=tmp;
				}
			}
		}
		printf("%lld %lld\n",p,q);
	}
}
signed main(){
	freopen("value.in","r",stdin);
	freopen("value.out","w",stdout);
	n=read();
	for(int i=1;i<=n;i++)a[i]=read();
	q=read();
	if(n<=2000&&q<=1e5)sub1::solve(),exit(0);
	if(q==1)sub2::solve(),exit(0);
	return 0;
}

